package com.example.streamproducer.controller;

import com.example.streamproducer.stream.MessageProducer;
import com.example.streamproducer.stream.MsgProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: lihui
 * @Date: 2022-03-23 09:11
 * @Description:
 */
@RestController
public class MessageController {

    @Autowired
    private MessageProducer messageProducer;

    @Autowired
    private MsgProducer msgProducer;

    @RequestMapping("/sendMessage")
    public void sendMessage(){
        System.out.println("sendMessage success");
        messageProducer.send("hello world!");
    }

    @RequestMapping("/sendMsg")
    public void sendMsg(){
        System.out.println("sendMsg success");
        msgProducer.send("hello world!");
    }

    @RequestMapping("/sendDefaultMsg")
    public void sendDefaultMsg(){
        System.out.println("sendDefaultMsg success");
        msgProducer.sendDefault("hello world!");
    }

}
